using System;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;

namespace ReactiveLang.State
{
    using Util;

    public class ChangeNotifierException: Exception
    {
        public MemberInfo Member { get; private set; }
        object[] _args;
        public object[] Args
        {
            get { return _args.ToArray(); }
        }
        public ChangeNotifierOptions Options { get; private set; }

        string _msg;

        public ChangeNotifierException(MemberInfo member, object[] args, ChangeNotifierOptions options)
        {
            Contract.Requires<ArgumentNullException>(member != null, "member");
            Contract.Requires<ArgumentNullException>(args != null, "args");

            Member = member;
            _args = args;
            Options = options;
            _msg = "MemberChangeNotifier returned null. Member: {0}".InvariantFormat(member);
        }

        public override string Message
        {
            get { return _msg; }
        }
    }
}